﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Ninject.Core;
using Ninject.Core.Behavior;
using Milkify.Interfaces;
using Milkify.Controllers;

namespace Milkify
{
    class MilkifyControllersModule : StandardModule
    {
        public override void Load()
        {
            Bind<IMainWindowController>().To<MainWindowController>().Using<SingletonBehavior>();

            foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                foreach (Type type in assembly.GetTypes())
                {
                    if (MilkifyControllerFactory.IsController(type))
                        Bind(type).ToSelf().Using<TransientBehavior>();
                }
            }
        }
    }
}
